//@flow

/**
 * app版本信息模型
 */

import React, { Component } from 'react';

type ResultProps = {
    version	                :string,
    minimumOsVersion	    :string,
}
type Props = {
    resultCount	:number,
    results     :Array<ResultProps>
}

export class AppVersionInfoModal{


    /**初始化函数 */
    constructor(props:Props){

        if(props.resultCount == 1){
            this._version = props.results[0].version;
            this._minOSVersion = props.results[0].minimumOsVersion;
            this._packageSize = props.results[0].fileSizeBytes;
            this._desc = props.results[0].releaseNotes;
        }else{
            this._version = '1.0.0'
            this._minOSVersion = '8.0'
            this._packageSize = null;
            this._desc = '新内容'
        }
    }
        /**版本号 */
        _version: string = '';
        get version(): string {
            return this._version;
            // return '1.0.0'
        }
        set version(value: string) {
            this._version = value;
        }
    
        /**最低系统版本 */
        _minOSVersion: string = '';
        get minOSVersion(): string {
            return this._minOSVersion;
        }
        set minOSVersion(value: string) {
            this._minOSVersion = value;
        }

        /**更新包大小 */
        _packageSize: number = 0;
        get packageSize(): number {
            return parseInt(this._packageSize / (1024*1024));
        }
        set packageSize(value: number) {
            this._packageSize = value;
        }

        /**新版本描述 */
        _desc: string = '';
        get desc(): string {
            return this._desc;
        }
        set desc(value: string) {
            this._desc = value;
        }

}